package com.cqjtu.tto.vo;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.cqjtu.tto.dao.pojo.EmployeePerformance;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.HashMap;

@Data
@ApiModel(value = "员工绩效视图模型")
public class EmployeePerformanceVo {
    private static HashMap<Integer, String> map;
    static {
        map = new HashMap<>();
        map.put(0,"未达标");
        map.put(1,"达标");
    }
    /**
     * 绩效id
     */
    @ApiModelProperty(value = "绩效id")
    @TableId(value = "employee_performance_id", type = IdType.AUTO)
    private Long employeePerformanceId;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    private Long userId;

    /**
     * 员工姓名
     */
    @ApiModelProperty(value = "员工姓名")
    private String name;

    /**
     * 员工绩效生成时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "员工绩效生成时间")
    private LocalDateTime employeePerformanceCreat;

    /**
     * 是否达标（0-未达标,1-达标）
     */
    @ApiModelProperty(value = "是否达标（0-未达标,1-达标）")
    private String standard;

    public EmployeePerformanceVo(EmployeePerformance employeePerformance, String name){
        this.employeePerformanceId = employeePerformance.getEmployeePerformanceId();
        this.userId = employeePerformance.getUserId();
        this.name = name;
        this.employeePerformanceCreat = employeePerformance.getEmployeePerformanceCreat();
        this.standard = map.get(employeePerformance.getStandard());
    }

}
